home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
rdblib
/
rbscrn.frm
< prev
next >
Wrap
Text File
|
1995-05-02
|
3KB
|
109 lines
VERSION 2.00
Begin Form RBScrn
BorderStyle = 0 'None
Caption = "Current Screen Print"
ClientHeight = 4020
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 7365
ControlBox = 0 'False
Height = 4425
HelpContextID = 39
Left = 1035
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
MousePointer = 11 'Hourglass
ScaleHeight = 4020
ScaleWidth = 7365
Top = 1140
Width = 7485
WindowState = 2 'Maximized
Begin PictureBox Picture1
AutoRedraw = -1 'True
BorderStyle = 0 'None
Height = 4035
Left = 0
ScaleHeight = 4035
ScaleWidth = 7395
TabIndex = 0
Top = 0
Visible = 0 'False
Width = 7395
End
End
Dim ljunk As Integer
Sub Form_Activate ()
mousepointer = HOURGLASS
ljunk = ShowWindow(RBProbRpt.hWnd, SW_HIDE)
ljunk = ShowWindow(RBErrFrm.hWnd, SW_HIDE)
ljunk = ShowWindow(RBScrn.hWnd, SW_HIDE)
DoEvents
mousepointer = HOURGLASS
GrabScreen
mousepointer = HOURGLASS
ljunk = ShowWindow(RBScrn.hWnd, SW_SHOW)
RBScrn.WindowState = MAXIMIZED
DoEvents
RBScrn.PrintForm
ljunk = ShowWindow(RBProbRpt.hWnd, SW_SHOW)
ljunk = ShowWindow(RBErrFrm.hWnd, SW_SHOW)
Unload RBScrn
End Sub
Sub GetTwipsPerPixel ()
' Set a global variable with the Twips to Pixel ratio.
RBScrn.ScaleMode = 3
NumPix = RBScrn.ScaleHeight
RBScrn.ScaleMode = 1
TwipsPerPixel = RBScrn.ScaleHeight / NumPix
End Sub
Sub GrabScreen ()
Dim winSize As lrect
' Assign information of the source bitmap.
' Note that BitBlt requires coordinates in pixels.
hwndSrc% = GetDesktopWindow()
hSrcDC% = GetDC(hwndSrc%)
XSrc% = 0: YSrc% = 0
Call GetWindowRect(hwndSrc%, winSize)
nWidth% = winSize.right ' Units in pixels.
nHeight% = winSize.bottom ' Units in pixels.
' Assign informate of the destination bitmap.
hDestDC% = RBScrn.Picture1.hDC
x% = 0: Y% = 0
' Set global variable TwipsPerPixel and use to set
' picture box to same size as screen being grabbed.
' If picture box not the same size as picture being
' BitBlt'ed to it, it will chop off all that does not
' fit in the picture box.
GetTwipsPerPixel
RBScrn.Picture1.Top = 0
RBScrn.Picture1.Left = 0
RBScrn.Picture1.Width = (nWidth% + 1) * TwipsPerPixel
RBScrn.Picture1.Height = (nHeight% + 1) * TwipsPerPixel
' Assign the value of the constant SRCOPYY to the Raster operation.
dwRop& = &HCC0020
' Note function call must be on one line:
Suc% = BitBlt(hDestDC%, x%, Y%, nWidth%, nHeight%, hSrcDC%, XSrc%, YSrc%, dwRop&)
' Release the DeskTopWindow's hDC to Windows.
' Windows may hang if this is not done.
Dmy% = ReleaseDC(hwndSrc%, hSrcDC%)
'Make the picture box visible.
RBScrn.Picture1.Visible = True
End Sub